package cn.copera.dyy.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import cn.copera.dyy.common.persistence.IdEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 店铺点赞设置
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "ka_pointpraise_set")
@DynamicInsert
@DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PointPraiseSet extends IdEntity<PointPraiseSet> {
	private static final long serialVersionUID = 1L;
	private Shop shop;// 店铺
	private String enabled;// 启用状态
	private Integer totalCount;// 累计点赞
	private Integer presenterCount;// 赠送点卡
	private Integer dayCount;// 每天每人允许点赞
	private String type;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "shop_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@JsonIgnore
	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public String getEnabled() {
		if(enabled==null){
			enabled="关闭";
		}
		return enabled;
	}
    
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setEnabled(String enabled) {
		this.enabled = enabled;
	}

	public Integer getTotalCount() {
		if(totalCount==null){
			totalCount=0;
		}
		return totalCount;
	}

	public void setTotalCount(Integer totalCount) {
		this.totalCount = totalCount;
	}

	public Integer getPresenterCount() {
		if(presenterCount==null){
			presenterCount=0;
		}
		return presenterCount;
	}

	public void setPresenterCount(Integer presenterCount) {
		this.presenterCount = presenterCount;
	}

	public Integer getDayCount() {
		if(dayCount==null){
			dayCount=0;
		}
		return dayCount;
	}

	public void setDayCount(Integer dayCount) {
		this.dayCount = dayCount;
	}

}
